#include<bits/stdc++.h>
using namespace std;

int main(){
    int n;
    cin>>n;
    vector<int> arr(n);
    for(int i = 0;i < n;i++){
        cin>>arr[i];
    }

    int cnt = 0;
    int ret = -1;
    for(int i = 0;i < arr.size();i++){
        int tmp = arr[i];
        if(tmp == arr[i+1]-1){
            cnt++;
        }else{
            ret = max(ret,cnt);
            cnt = 0;
        }

    }
    cout<<ret+1<<endl;


    return 0;
}